import numpy as np

import recommend_news.code.Utils as Utils

click_df = Utils.get_all_click_sample(np.array(["../data/train_click_log.csv", "../data/testA_click_log.csv"]),
                                      sample_nums=1000)

i2i_sim = Utils.itemcf_sim(click_df)

user_recall_items_dict = Utils.item_based_recommend_users(click_df, i2i_sim, 10, 10, 50)

recall_df = Utils.dict2DataFrame(user_recall_items_dict)

click_df_test = Utils.get_all_click_sample(np.array(["../data/testA_click_log.csv"]),
                                           sample_nums=0)

test_users = click_df_test["user_id"].unique()
recall_df = recall_df[recall_df["user_id"].isin(test_users)]

Utils.submit(recall_df, 5, "itemcf_baseline")
